using System.ComponentModel.DataAnnotations;
using MediatR;
using SmartTracking.ErrorCode;

namespace BaseData.WriteApi.Appcontext.Command.DescendantFiles
{
    /// <summary>
    /// 后裔档案初期状态修改命令
    /// </summary>
    public class UpdateDescendantInitialstateCommand : IRequest<ApiResult<bool>>
    {
        /// <summary>
        /// 后裔档案ID
        /// </summary>
        [Required]
        public int DescendantId { get; set; }

        /// <summary>
        /// 新的初期状态值
        /// </summary>
        [Required]
        public bool Initialstate { get; set; }

        /// <summary>
        /// 验证命令参数
        /// </summary>
        /// <returns>验证结果</returns>
        public bool Validate(out string errorMessage)
        {
            errorMessage = string.Empty;

            if (DescendantId <= 0)
            {
                errorMessage = "后裔档案ID必须大于0";
                return false;
            }

            return true;
        }
    }
}